I created this website to track the progress with the sweetgum genetic study.
There are 7 parts:
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggpubr)
library(plotly)
##
## Attaching package: 'plotly'
##
## The following object is masked from 'package:ggplot2':
##
## last_plot
##
## The following object is masked from 'package:stats':
##
## filter
##
## The following object is masked from 'package:graphics':
##
## layout
hane_crown <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_crown.csv",
header = T)
hane_gld <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_gld.csv",
header = T)
hane_dbh <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_dbh.csv",
header = T)
hane_ht <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_ht.csv",
header = T)
hane_survival_year <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_survival_year.csv",
header = T)
hane_survival_year_family <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_survival_year_family.csv",
header = T)
hane_survival_year_location <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_survival_year_location.csv",
header = T)
hane_survival_year_location_family <- read.csv("https://raw.githubusercontent.com/azd169/R-datasets/main/hane_survival_year_location_family.csv",
header = T)
hane_crown <- hane_crown %>%
mutate(Year = fct_relevel(Year, c("Fifth", "Sixth", "Seventh")))
hane_gld <- hane_gld %>%
mutate(Year = fct_relevel(Year, c("Initial", "First", "Second")))
hane_dbh <- hane_dbh %>%
mutate(Year = fct_relevel(Year, c("Third", "Fourth", "Fifth", "Sixth", "Seventh")))
hane_ht <- hane_ht %>%
mutate(Year = fct_relevel(Year, c("Initial", "First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh")))
hane_survival_year <- hane_survival_year %>%
mutate(Year = fct_relevel(Year, c("Initial", "First", "Second")))
hane_survival_year_family <- hane_survival_year_family %>%
mutate(Year = fct_relevel(Year, c("Initial", "First", "Second")))
hane_survival_year_location <- hane_survival_year_location %>%
mutate(Year = fct_relevel(Year, c("Initial", "First", "Second")))
hane_survival_year_location_family <- hane_survival_year_location_family %>%
dplyr::mutate(ID = paste(Location, Year, sep = ", ")) %>%
mutate(ID = fct_relevel(ID, c("Hill Farm, Initial", "Hill Farm, First", "Hill Farm, Second",
"LA Tech, Initial", "LA Tech, First", "LA Tech, Second")))
Procedure:
External trees were removed from the analysis and all the Variables were averaged at plot level. A unique ID was created combining Genotype, Location, and Block (GLD in the SAS code)
Datasets used:
Here are the SAS models:
PROC GLIMMIX DATA = GLD H PLOTS = ALL; CLASS Year Location Block Family GLB; MODEL GLD = Year|Location|Family / SOLUTION DDFM = KR; RANDOM intercept / SOLUTION SUBJECT = GLB TYPE = AR(1) CL; LSMEANS Location Family Year * Location Year * Family/ ADJUST = TUKEY LINES; ODS GRAPHICS OFF; RUN;
PROC GLIMMIX DATA = HEIGHT H PLOTS = ALL; CLASS Year Location Block Family GLB; MODEL Height = Year|Location|Family / SOLUTION DDFM = KR; RANDOM intercept / SOLUTION SUBJECT = GLB TYPE = AR(1) CL; LSMEANS Family/ ADJUST = TUKEY LINES; SLICE Year * Location / SLICEBY = Year ADJUST = TUKEY LINES DIFF; SLICE Year * Family / SLICEBY = Year ADJUST = TUKEY LINES DIFF; ODS GRAPHICS OFF; RUN;
PROC GLIMMIX DATA = DBH H PLOTS = ALL; CLASS Year Location Block Family GLB; MODEL DBH = Year|Location|Family / SOLUTION DDFM = KR; RANDOM intercept / SOLUTION SUBJECT = GLB TYPE = AR(1) CL; LSMEANS Family/ ADJUST = TUKEY LINES; SLICE Year * Location / SLICEBY = Year ADJUST = TUKEY LINES DIFF; SLICE Year * Family / SLICEBY = Year ADJUST = TUKEY LINES DIFF; ODS GRAPHICS OFF; RUN;
PROC GLIMMIX DATA = CROWN H PLOTS = ALL; CLASS Year Location Block Family GLB; MODEL CROWN = Year|Location|Family / SOLUTION DDFM = KR; RANDOM intercept / SOLUTION SUBJECT = GLB TYPE = AR(1) CL; LSMEANS Family/ ADJUST = TUKEY LINES; SLICE Year * Location / SLICEBY = Year ADJUST = TUKEY LINES DIFF; SLICE Year * Family / SLICEBY = Year ADJUST = TUKEY LINES DIFF; ODS GRAPHICS OFF; RUN;
Sur1 <- ggplot(hane_survival_year,
aes(x = Survival, y = Rate, fill = Survival, Color = Survival)) +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 100), breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("green4", "red3"), 0.5)) +
labs(title = "Survival Rate by Growing Season") +
xlab("") +
ylab("Survival rate (%)") +
facet_wrap( ~ Year) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Sur1)
Sur2 <- ggplot(hane_survival_year_family,
aes(x = Family, y = Rate, fill = Survival, color = Survival)) +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 100), breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("green4", "red3"), 0.5)) +
labs(title = "Survival Rate by Growing Season and Family") +
xlab("") +
ylab("Survival rate (%)") +
facet_wrap( ~ Year) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Sur2)
Sur3 <- ggplot(hane_survival_year_location,
aes(x = Location, y = Rate, fill = Survival, Color = Survival)) +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 100), breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("green4", "red3"), 0.5)) +
labs(title = "Survival Rate by Growing Season and Location") +
xlab("") +
ylab("Survival rate (%)") +
facet_wrap( ~ Year) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Sur3)
Sur4 <- ggplot(hane_survival_year_location_family,
aes(x = Family, y = Rate, fill = Survival, color = Survival)) +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 100), breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("green4", "red3"), 0.5)) +
labs(title = "Survival Rate by Growing Season, Location, and Family") +
xlab("") +
ylab("Survival rate (%)") +
facet_wrap( ~ ID, ncol = 3) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Sur4)
Fig1 <- ggplot(hane_gld,
aes(x = Family, y = GLD, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 60), breaks = c(0, 10, 20, 30, 40, 50, 60), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "GLD: Family Effect") +
xlab("Family") +
ylab("GLD (mm)") +
annotate("text",
x = c(1, 2, 3, 4, 5, 6),
y = c(50),
label = c("b", "ab", "a", "a", "ab", "ab")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig1)
Fig2 <- ggplot(hane_gld,
aes(x = Year, y = GLD, fill = Location, color = Location)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 70), breaks = c(0, 10, 20, 30, 40, 50, 60, 70), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#000000", "#999999"), 0.5)) +
labs(title = "GLD: Year * Location") +
xlab("Growing Season") +
ylab("GLD (mm)") +
annotate("text",
x = c(1.78, 2.22, 2.78, 3.22),
y = c(20, 20, 55, 50),
label = c("b", "a", "a", "b")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig2)
Fig3 <- ggplot(hane_gld,
aes(x = Year, y = GLD, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 80), breaks = c(0, 10, 20, 30, 40, 50, 60, 70, 80), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "GLD: Year * Family") +
xlab("Growing Season") +
ylab("GLD (mm)") +
annotate("text",
x = c(2.62, 2.78, 2.93, 3.08, 3.22, 3.38),
y = c(45, 50, 55, 60, 55, 55),
label = c("b", "b", "a", "a", "a", "a")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig3)
Fig4 <- ggplot(hane_ht,
aes(x = Family, y = Height, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 12), breaks = c(0, 2, 4, 6, 8, 10, 12), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "Height: Year * Location") +
xlab("Family") +
ylab("Height (m)") +
annotate("text",
x = c(1, 2, 3, 4, 5, 6),
y = c(10),
label = c("d", "cd", "a", "a", "bc", "ab")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig4)
Fig5 <- ggplot(hane_ht,
aes(x = Year, y = Height, fill = Location, color = Location)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 12), breaks = c(0, 2, 4, 6, 8, 10, 12), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#000000", "#999999"), 0.5)) +
labs(title = "Height: Year * Location" ) +
xlab("Growing Season") +
ylab("Height (m)") +
annotate("text",
x = c(3.78, 4.22, 4.78, 5.22, 5.78, 6.22, 6.78, 7.22),
y = c(5, 4, 7, 5.5, 8.5, 7.5, 11, 7.5),
label = c("a", "b", "a", "b", "a", "b", "a", "b")) +
theme_classic()
plotly::ggplotly(Fig5)
Fig6 <- ggplot(hane_ht,
aes(x = Year, y = Height, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 12), breaks = c(0, 2, 4, 6, 8, 10, 12), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "Height: Year * Family") +
xlab("Growing Season") +
ylab("Height (m)") +
annotate("text",
x = c(2.63, 2.77, 2.92, 3.06, 3.22, 3.38,
3.63, 3.77, 3.92, 4.06, 4.22, 4.38,
4.63, 4.77, 4.92, 5.06, 5.22, 5.38,
5.63, 5.77, 5.92, 6.06, 6.22, 6.38,
6.63, 6.77, 6.92, 7.06, 7.22, 7.38,
7.63, 7.77, 7.92, 8.06, 8.22, 8.38
),
y = c(2.2, 2.5, 3, 3.3, 2.7, 2.9,
3.1, 3.3, 4.3, 4.5, 3.7, 3.9,
5, 5.5, 6.5, 6.8, 5.9, 6.2,
6.5, 7, 8.1, 8.4, 7.4, 7.8,
7.7, 8.5, 10.4, 10.4, 9.8, 10.2,
9.3, 9.2, 10.5, 10.4, 10, 10.3
),
label = c("c", "bc", "a", "a", "abc", "ab",
"c", "bc", "a", "a", "bc", "ab",
"d", "cd", "ab", "a", "bc", "ab",
"c", "bc", "a", "a", "b", "a",
"c", "c", "a", "a", "b", "ab",
"dc", "d", "a", "a", "bc", "ab"
)) +
theme_classic()
plotly::ggplotly(Fig6)
Fig7 <- ggplot(hane_dbh,
aes(x = Family, y = DBH, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 20), breaks = c(0, 5, 10, 15, 20), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "DBH: Family Effect") +
xlab("Family") +
ylab("DBH (cm)") +
annotate("text",
x = c(1, 2, 3, 4, 5, 6),
y = c(15),
label = c("d", "cd", "b", "b", "cb", "a")) +
theme_classic()
plotly::ggplotly(Fig7)
Fig8 <- ggplot(hane_dbh,
aes(x = Year, y = DBH, fill = Location, color = Location)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 20), breaks = c(0, 5, 10, 15, 20), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#000000", "#999999"), 0.5)) +
labs(title = "DBH: Year * Location" ) +
xlab("Growing Season") +
ylab("DBH (cm)") +
annotate("text",
x = c(0.78, 1.22, 1.78, 2.22, 2.78, 3.22, 3.78, 4.22, 4.78, 5.22),
y = c(5, 4, 8, 7, 11, 10, 13, 12, 14, 13),
label = c("a", "b", "a", "b", "a", "b", "a", "b", "a", "b")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig8)
Fig9 <- ggplot(hane_dbh,
aes(x = Year, y = DBH, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 20), breaks = c(0, 5, 10, 15, 20), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "DBH: Year * Family") +
xlab("Growing Season") +
ylab("DBH (cm)") +
annotate("text",
x = c(0.63, 0.77, 0.92, 1.06, 1.22, 1.38,
1.63, 1.77, 1.92, 2.06, 2.22, 2.38,
2.63, 2.77, 2.92, 3.06, 3.22, 3.38,
3.63, 3.77, 3.92, 4.06, 4.22, 4.38,
4.63, 4.77, 4.92, 5.06, 5.22, 5.38
),
y = c(3.2, 3.5, 5, 5.3, 4.7, 4.9,
6.1, 6.3, 7.8, 7.9, 7.5, 8.5,
8.9, 9.3, 10.1, 10.2, 10.8, 11.8,
11.1, 11.3, 11.9, 12.3, 12.8, 13.2,
12.7, 12.7, 12.9, 13.1, 13.5, 14.7
),
label = c("c", "c", "ab", "a", "bc", "a",
"d", "cd", "b", "b", "bc", "a",
"c", "c", "b", "b", "b", "a",
"d", "cd", "bcd", "bc", "b", "a",
"b", "b", "b", "b", "b", "a"
)) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig9)
Fig10 <- ggplot(hane_crown,
aes(x = Family, y = Crown, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 10), breaks = c(0, 2, 4, 6, 8, 10), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "Crown Height: Family Effect") +
xlab("Family") +
ylab("Crown Height (m)") +
annotate("text",
x = c(1, 2, 3, 4, 5, 6),
y = c(8),
label = c("b", "b", "a", "a", "a", "a")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig10)
Fig11 <- ggplot(hane_crown,
aes(x = Year, y = Crown, fill = Location, color = Location)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 10), breaks = c(0, 2, 4, 6, 8, 10), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#000000", "#999999"), 0.5)) +
labs(title = "Crown Height: Year * Location" ) +
xlab("Growing Season") +
ylab("Crown Height (m)") +
annotate("text",
x = c(0.78, 1.22, 1.78, 2.22, 2.78, 3.22),
y = c(3.2, 1.7, 6.5, 4, 7.3, 5),
label = c("a", "b", "a", "b", "a", "b")) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig11)
Fig12 <- ggplot(hane_crown,
aes(x = Year, y = Crown, fill = Family, color = Family)) +
stat_summary(fun.data = mean_sd, geom = "errorbar", position = position_dodge(0.9), width = 0.2, color = "grey") +
stat_summary(fun = mean, geom = "bar", position = "dodge") +
font("title", size = 22) +
font("xlab", size = 18) +
font("ylab", size = 18) +
font("xy.text", size = 16) +
scale_y_continuous(limits = c(0, 10), breaks = c(0, 2, 4, 6, 8, 10), expand = c(0,0)) +
scale_fill_manual(values = alpha(c("#E69F00", "#56B4E9", "#009E73",
"#F0E442", "#D55E00", "#CC79A7"), 0.5)) +
labs(title = "Crown Height: Year * Family") +
xlab("Growing Season") +
ylab("Crown Height (m)") +
annotate("text",
x = c(1.63, 1.77, 1.92, 2.06, 2.22, 2.36,
2.63, 2.77, 2.92, 3.06, 3.22, 3.36
),
y = c(2.5, 3.4, 6, 6.5, 5.5, 5.7,
4, 3.9, 7.2, 7.3, 6.1, 6.6
),
label = c("b", "b", "a", "a", "a", "a",
"b", "b", "a", "a", "a", "a"
)) +
guides(fill = "none") +
theme_classic()
plotly::ggplotly(Fig12)